package com.ai.databao.service.impl;

import com.ai.databao.web.controller.vo.LmzxQueryInfoVO;
import org.apache.http.message.BasicNameValuePair;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * Created by fangyunfeng on 2017/8/2.
 */
@Service
public class LmzxQuerySVImpl extends AbstractLmzxQuery implements ILmzxQuerySV {

    /**
     * 查询状态
     * @param token
     * @param bizType
     * @return
     */
    public String qryStatus(String token,String bizType){
        List<BasicNameValuePair> reqParams = new ArrayList<BasicNameValuePair>();
        reqParams.add(new BasicNameValuePair("token",token));
        reqParams.add(new BasicNameValuePair("bizType",bizType));
        reqParams.add(new BasicNameValuePair("method","api.common.getStatus"));

        String json = doPost(reqParams);

        return json;
    }

    /**
     * 查询结果
     * @param token
     * @param bizType
     * @return
     */
    public String qryResult(String token,String bizType){
        List<BasicNameValuePair> reqParams = new ArrayList<BasicNameValuePair>();
        reqParams.add(new BasicNameValuePair("token",token));
        reqParams.add(new BasicNameValuePair("bizType",bizType));
        reqParams.add(new BasicNameValuePair("method","api.common.getResult"));

        String json = doPost(reqParams);

        return json;
    }

    /**
     * 央行征信查询
     * @param queryInfoVo
     * @return
     */
    public String qryCredit(LmzxQueryInfoVO queryInfoVo){
        List<BasicNameValuePair> reqParams = new ArrayList<BasicNameValuePair>();
        reqParams.add(new BasicNameValuePair("identityCardNo",queryInfoVo.getIdentityCardNo()));
        reqParams.add(new BasicNameValuePair("identityName",queryInfoVo.getIdentityName()));
        reqParams.add(new BasicNameValuePair("username",queryInfoVo.getUsername()));
        reqParams.add(new BasicNameValuePair("password",queryInfoVo.getPassword()));
        reqParams.add(new BasicNameValuePair("middleAuthCode",queryInfoVo.getMiddleAuthCode()));
        reqParams.add(new BasicNameValuePair("uid",queryInfoVo.getUid()));
        reqParams.add(new BasicNameValuePair("method","api.credit.get"));
        String json = doBizPost(reqParams);

        return json;
    }

    /**
     * 社保地区列表查询
     * @param
     * @return
     */
    public String qrySocialSecurityAreas(){
        List<BasicNameValuePair> reqParams = new ArrayList<BasicNameValuePair>();
        reqParams.add(new BasicNameValuePair("method","api.socialsecurity.getareas"));
        String json = doPost(reqParams);
        return json;
    }

    /**
     * 社保地区登陆元素查询
     * @param
     * @return
     */
    public String qrySocialSecurityElem(String areaCode){
        List<BasicNameValuePair> reqParams = new ArrayList<BasicNameValuePair>();
        reqParams.add(new BasicNameValuePair("areaCode",areaCode));
        reqParams.add(new BasicNameValuePair("method","api.socialsecurity.getloginelements"));
        String json = doPost(reqParams);
        return json;
    }

    /**
     * 社保查询
     * @param reqParams
     * @return
     */
    public String qrySocialSecurity(List<BasicNameValuePair> reqParams){
        reqParams.add(new BasicNameValuePair("method","api.socialsecurity.get"));
        String json = doBizPost(reqParams);
        return json;
    }

    /**
     * 公积金地区列表查询
     * @param
     * @return
     */
    public String qryHouseFundAreas(){
        List<BasicNameValuePair> reqParams = new ArrayList<BasicNameValuePair>();
        reqParams.add(new BasicNameValuePair("method","api.housefund.getareas"));
        String json = doPost(reqParams);
        return json;
    }

    /**
     * 公积金地区登陆元素查询
     * @param
     * @return
     */
    public String qryHouseFundElem(String areaCode){
        List<BasicNameValuePair> reqParams = new ArrayList<BasicNameValuePair>();
        reqParams.add(new BasicNameValuePair("areaCode",areaCode));
        reqParams.add(new BasicNameValuePair("method","api.housefund.getloginelements"));
        String json = doPost(reqParams);
        return json;
    }

    /**
     * 公积金查询
     * @param reqParams
     * @return
     */
    public String qryHouseFund(List<BasicNameValuePair> reqParams){
        reqParams.add(new BasicNameValuePair("method","api.housefund.get"));
        String json = doBizPost(reqParams);
        return json;
    }
}
